﻿@{
    ViewBag.Title = "添加项目";
    Layout = "~/Views/Shared/_Layout.cshtml";
    
  
}
@using LY.Entity
@model LY.Entity.R_ProjectItem
<link href="~/Content/validform.css" rel="stylesheet" />
@section style
{
    <style type="text/css">
        .foot {
            margin: 30px auto;
            width: 1000px;
            background-color: rgb(249,207,207);
        }

            .foot p {
                padding-left: 20px;
                font-size: 14px;
            }
    </style>
}
<script src="~/Scripts/Validform_v5.3.2_min.js"></script>
<script src="~/Scripts/Validform_Datatype.js"></script>
@section scripts
{
    <script type="text/javascript">
        $(function () {
            //验证初始化
            $("form").Validform({
                tiptype: 3
            });

            $("#changeAddredd").click(function () {
                $("#address").hide();
                $("#hehehe").show();
            });

            $("#next").click(function () {
                if ($("#AddressId").val() == null || $("#AddressId").val() == "") {
                    $.dialog.alert("请先设置默认地址");
                    return;
                }
                $("#formOrder").submit();
            });
            $(":radio[name='NeedInvoice']").change(function () {
                var value = $(this).attr("checked", true).val();
                if (value == "1") {
                    $("#invoiceTitleDetail").css('display', 'block');
                } else {
                    $("#invoiceTitleDetail").css('display', 'none');
                }
            });
            if ('@ViewBag.NeedInvoice' != "") {
                $(":radio[value='@ViewBag.NeedInvoice']").attr("checked", true).change();
            }
        });
    </script>
}
<div class="line10"></div>
<div class="container">
    <div class="order-process">
        <ul>
            <li class="active">订单详细填写页</li>
            <li>订单信息确认页</li>
            <li>支付</li>
            <li>完成</li>
        </ul>
    </div>
    <form id="formOrder" action="@Url.Action("SaveOrder")" method="post" >
        <div class="additem">
            @{
                if (ViewBag.Id == null)
                {
                    ViewBag.Id = 0;
                }
            }
            <input type="hidden" name="Id" class="Id" value="@ViewBag.Id"/>
            <input type="hidden" name="Freight" id="Freight" value="@Model.Freight"/>
            <input type="hidden" name="ProjectId" class="ProjectId" value="@Model.ProjectId"/>
            <input type="hidden" name="ProjectItemId" class="ProjectItemId" value="@Model.Id"/>
            <input type="hidden" name="projectName" value="@ViewBag.ProjectName"/>
            <div style="margin: 10px 0px;"><h4 id="editInfo" style="font-size: 18px;">@ViewBag.ProjectName</h4></div>
            <div style="height: 2px;background-color: red;"></div>
            <dl>
                <dt>支付金额(包含运费)：</dt>
                @{
                    decimal? laseAmount;
                    if (Model.Freight == null)
                    {
                        laseAmount = Model.Amount;
                    }
                    else
                    {
                        laseAmount = Model.Amount + Model.Freight;
                    }
                }
                <dd>￥@laseAmount 元
                    <input type="hidden" name="Amount" value="@laseAmount"/>
                </dd>
            </dl>
            <dl>
                <dt>配送费用：</dt>
                <dd>
                    @if (Model.Freight > 0)
                    {
                        <label>￥@Model.Freight 元</label>
                    }
                    else
                    {
                        <label>免运费</label>
                    }
                </dd>
            </dl>
            <dl>
                <dt>回报内容：</dt>
                <dd>
                    @Model.RedoundContent
                </dd>
            </dl>
            <dl>
                <dt>发票：</dt>
                <dd>
                    @Html.ResourceRadioList("NeedInvoice", "NeedInvoice", 0, true)

                </dd>
            </dl>
            <div class="new_add pt10" style="display: none;" id="invoiceTitleDetail">
                <dl>
                    <dt><span class="f_red">*</span> 发票抬头：</dt>
                    <dd>
                        <input name="InvoiceTitle" id="InvoiceTitle" type="text" maxlength="30" class="input normal"value="个人" />
                    </dd>
                </dl>
            </div>
            <dl>
                <dt>备注：</dt>
                <dd>
                    <input type="text" class="input normal" name="Remark"   value="@ViewBag.remark" />
                </dd>
            </dl>
            <dl>
                <dt>收货信息：</dt>
                <dd>
                    @{
                        U_UserAddress address = ViewBag.Address;
                        if (address == null)
                        {
                            
                        <a href="/Account/UserAddress?ProjectId=@Model.ProjectId&ProjectItemId=@Model.Id&Id=@ViewBag.Id" style="color: red">点击设置默认地址</a>
                     
                        }
                        else
                        {
                        <div id="address">
                            <label>@address.Name</label>
                            <label>@address.Tel (手机号码接受回报信息,请确认无误)</label><br />
                            <label>@address.Address</label><a href="javascript:void(0);" id="changeAddredd">修改</a>
                            <input type="hidden" id="AddressId" name="AddressId" value="@address.Id"/>
                        </div>
                        <div id="hehehe" style="display: none">
                            @{
                            List<U_UserAddress> list = ViewBag.MemberAddresses;
                            foreach (var adds in list)
                            {
                                <input type="radio" name="nicai" value="@adds.Id"/>
                                <label>@adds.Name  </label>
                                <label>@adds.Tel  </label>
                                <label>@adds.Address  </label> <br />                            
                            }
                            }
                            <a href="/Account/UserAddress?ProjectId=@Model.ProjectId&ProjectItemId=@Model.Id&Id=@ViewBag.Id" style="color: red">新增地址</a>

                        </div>
                        }
                    }
                </dd>
            </dl>
        </div>
        <hr />

        <div class="foot">
            <br />
            <br />
            <p><strong>风险说明:</strong></p>
            <br />
            <p>1、众筹成功后，如果出现项目方回报无法发放的情况，您需要直接和项目发起人协商解决退款事宜，全局金服没有帮您追讨资金的义务。</p>
            <br />
            <p>2、支持纯抽奖档位，一旦您支付成功将不予退款，项目募集失败的除外；支持无私奉献档位，项目一旦募集成功将不予退款。</p>
            <br />
            <p>3、全局金服只提供平台服务，回报由项目发起人为您提供并负责发货，同时项目发起人有为您开具发票额法定义务。</p>
            <br />
            <p><strong>特别说明：</strong></p>
            <br />
            <p>系统会自动对超出限额的订单进行全额退款。对您造成的不便，深表歉意！</p>
            <br />
            <br />
        </div>

        <div class="btn-list">
            <div>
                <input id="next" type="button" class="button" value="下一步" />
            </div>
        </div>
    </form>
</div>
}




